#include "log/log.h"
#include "cJSON/cJSON.h"
#include <stdlib.h>

int main(int argc, char const *argv[])
{
    cJSON *root = cJSON_CreateObject();
    cJSON_AddStringToObject(root, "name", "zhangsan");
    cJSON_AddNumberToObject(root, "age", 18);
    char *json = cJSON_PrintUnformatted(root);
    log_debug("json: %s", json);
    cJSON *parse = cJSON_Parse(json);
    int age = cJSON_GetObjectItem(root, "age")->valueint;
    char *name = cJSON_GetObjectItem(root, "name")->valuestring;
    log_debug("age: %d, name: %s", age, name);
    cJSON_Delete(root);
    cJSON_Delete(parse);
    free(json);
    return 0;
}
